/* These help in encoding byte-level indices: 1st byte's top 2 bits tell the #of bytes - 1 in offset-difference encoding; offset-diff 0 => new file follows */
#define MaxNum1BPartition (MaxNum8bPartition & 0x3f) /* 62: top byte is 0x00 | x % MaxNum8bPartition === x; just encode x */
#define MaxNum2BPartition (MaxNum1BPartition * MaxNum8bPartition) /* top byte = 0x40 | x / MaxNum8bPartition; rest is x % ~; encode both separately */
#define MaxNum3BPartition (MaxNum1BPartition * MaxNum16bPartition) /* top byte = 0x80 | x / MaxNum16bPartition; rest is x % ~; encode both separately */
#define MaxNum4BPartition (MaxNum1BPartition * MaxNum24bPartition) /* top byte = 0xc0 | x / MaxNum24bPartition; rest is x % ~; encode both separately */
#define MIN_WORDS 50 /* before we inform abouit numeric words */
#define MAX_SEARCH_PERCENT 20 /* warn user if searching > this % of blocks */
#define DEF_MAX_INDEX_PERCENT 80 /* if word in > 80%, say everywhere for one-file-per-block */
#define DONT_CONFUSE_SORT 1
#define WORD_END_MARK 2
#define ALL_INDEX_MARK 3 /* If this, then word is in > 60% of blocks */
#define ATTR_END_MARK 4 /* After list of attributes before file offset/block numbers */
#define MAX_NAME_SIZE 256
#define MAX_NAME_LEN MAX_NAME_SIZE
#define MaxNameLength MAX_NAME_SIZE
#define MAX_LINE_SIZE 1024
#define MAX_LINE_LEN 1024
#define MAX_SORTLINE_LEN (MAX_LINE_LEN * 16) /* Can be ((MaxNum16bPartition*sizeof(int)+MAX_NAME_LEN)*MAX_INDEX_PERCENT/100) in the worst case */
#define MAX_NAME_BUF 256
#define MAX_WORD_SIZE 24 /* w/o '\0' */
#define MAX_WORD_LEN MAX_WORD_SIZE
#define MAX_WORD_BUF 32
#define MAX_PAT 256
#define MAXNUM_FILE MaxNum16bPartition
#define MAX_INDEX_BUF (MAX_PARTITION + 1 + 2*MAX_WORD_BUF + 2) /* index line length without OneFilePerBlock */
#define REAL_INDEX_BUF (MAXNUM_FILE*2 + 2*MAX_WORD_BUF + 2) /* index line length with OneFilePerBlock */
#define DEFAULT_REGION_LIMIT 256 /* default limit for a record: for ByteLevelIndex: pattern is ignored since can't avoid false matches w/o search */
#define MAX_REGION_LIMIT 16384 /* max amount of space I am going allocate for a record bounded by a delimiter */
#define MAX_PER_LINE (MAX_SORTLINE_LEN / 2) /* #of words that can occur on one line before we split it up: not implemented at present */
#define DEF_MAX_PER_MB 500 /* Maximum number of times a word should occur in a megabyte before we say its everywhere */
#define DEF_ALL_INDEX 10000 /* Must be < MAX_ALL_INDEX */
#define MAX_ALL_INDEX (REAL_INDEX_BUF / 2) /* THIS * 2 must be < REAL_INDEX_BUF to prevent seg-faults! */
#define FILESET_SIZE MAXNUM_FILE /* used when OneFilePerBlock is ON */
#define FILEMASK_SIZE (FILESET_SIZE/(8*sizeof(int)) + 4) /* bit mask of files */
#define REAL_PARTITION (FILEMASK_SIZE + 4) /* must be > MAX_PARTITION */
/* block must be in 0..FILESET_SIZE-1, and integers should represent bit-masks */
#define block2index(i) (i/(8*sizeof(int)))
#define block2mask(i) (1<<(i%(8*sizeof(int)))) /* not used */